<?php
/**
 * @package		Joomla.Site
 * @subpackage	MOD_NOTIFICATION
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
?>
<script type="text/javascript">
	jQuery.noConflict();
	jQuery(document).ready(function(){
		jQuery(".dropdown dt a").click(function() {
		        // Change the behaviour of onclick states for links within the menu.
			var toggleId = "#" + this.id.replace(/^link/,"ul");			
		        // Hides all other menus depending on JQuery id assigned to them
			jQuery(".dropdown dd ul").not(toggleId).hide();

		        //Only toggles the menu we want since the menu could be showing and we want to hide it.
			jQuery(toggleId).toggle();			
		        //Change the css class on the menu header to show the selected class.
		    if (toggleId != "#ulglobal"){		    	
		    	jQuery("#linkglobal").removeClass("selecteds");		    			    
				if(jQuery(toggleId).css("display") == "none"){				
					jQuery(this).removeClass("selected");								
					jQuery(this).addClass("notif");					
				}else{
					jQuery(this).addClass("selected");
					jQuery(this).removeClass("notif");										
					jQuery("div#arrowImage").addClass("arrowImage");			 				
					jQuery("div#arrowImage").removeClass("arrowImageWhite");
				}
		    }else{		    	
		    	jQuery("#linkg").removeClass("selected");
		    	jQuery("#linkg").addClass("notif");
		    	if(jQuery(toggleId).css("display") == "none"){				
					jQuery(this).removeClass("selecteds");		
					jQuery("div#arrowImage").addClass("arrowImage");			 				
					jQuery("div#arrowImage").removeClass("arrowImageWhite"); 					
				}else{
					jQuery(this).addClass("selecteds");
					jQuery("div#arrowImage").removeClass("arrowImage"); 
					jQuery("div#arrowImage").addClass("arrowImageWhite");					
				}
			}
			jQuery("#ulglobal a").click(function (){
				jQuery("#linkglobal").removeClass("selecteds"); 				
				jQuery("div#arrowImage").removeClass("arrowImageWhite"); 
				jQuery("div#arrowImage").addClass("arrowImage");
			});			
		});
		jQuery(".dropdown dd ul li a").click(function() {
		    // This is the default behaviour for all links within the menus
		    var text = jQuery(this).html();
		    jQuery(".dropdown dt a span").html(text);
		    jQuery(".dropdown dd ul").hide();
		});
		jQuery(document).bind('click', function(e) {
		    // Lets hide the menu when the page is clicked anywhere but the menu.
		    var $clicked = jQuery(e.target);								
		    if (! $clicked.parents().hasClass("dropdown")){				
		        jQuery(".dropdown dd ul").hide();
				jQuery(".dropdown dt a").removeClass("selected");
				jQuery("#linkglobal").removeClass("selecteds");
				jQuery("#linkg").removeClass("selected");
		    	jQuery("#linkg").addClass("notif");
		    	jQuery("img#imagearrow").attr("src", "images/arrowdown.gif");
				jQuery("div#arrowImage").removeClass("arrowImageWhite");
		    	jQuery("div#arrowImage").addClass("arrowImage");	
			}
		    
		});
	});
</script>
<style type="text/css"><!--

--></style>
	
<?php if ($type == 'logout') : ?>
<form action="<?php echo JRoute::_('index.php', true, $params->get('usesecure')); ?>" name="logouSubmit" method="post" id="login-form">
<?php if ($params->get('greeting')) : ?>
	<div>
	    <dl style="" class="dropdown">
	       <dt><a class="notif" id="linkg" style="cursor: pointer;">&nbsp;</a></dt>
			<dd>
	            <ul class="notification" style="display: none;" id="ulg">
	            	<li class="notif-label"><div class="text-notifi"><a class="tst" href="testing"><?php echo JText::_('Notifications');?></a></div></li>
	                <li><div class="text-notifi-element"><a href="#">Ya Cy</a> I want to add your birthday to MyCalendar in <a href="#">MyCalendar - Birthdays.</a> <span class="notif-timer">2:57pm</span></div></li>
	                <li><div class="text-notifi-element"><a href="#">Ya Cy</a> I want to add your birthday to MyCalendar in <a href="#">MyCalendar - Birthdays.</a> <span class="notif-timer">2:57pm</span></div></li>
	                <li><div class="text-notifi-element"><a href="#">Ya Cy</a> I want to add your birthday to MyCalendar in <a href="#">MyCalendar - Birthdays.</a> <span class="notif-timer">2:57pm</span></div></li>
	                <li><div class="text-notifi-element"><a href="#">Ya Cy</a> I want to add your birthday to MyCalendar in <a href="#">MyCalendar - Birthdays.</a> <span class="notif-timer">2:57pm</span></div></li>	                
	                <li class="notif-labelall"><a class="tst1" href="#"><?php echo JText::_('See All Notifications');?></a></li>
	          </ul>
	       </dd>
	    </dl>
	</div>
	<div class="candidate">
		<div style="height:auto;">
			<div style="width:auto;">
			    <dl style="" class="dropdown">
			       <dt>
					  	<a id="linkglobal">
					  		<div style="float: left">				   						   		
						   	<?php if($params->get('name') == 0) : {
									$name = $user->get('name');
								} else : {
									$name = $user->get('username');
								} endif;
								if (strlen($name) > 12){											
									echo JText::sprintf(substr($name, 0, 12))."..."; 
								}else{
									echo JText::sprintf($name); 
								}								
							 ?>				
							</div>
							<div id="arrowImage" class="arrowImage"></div>
							<div style="clear: both"></div>							
						</a>
					</dt>
					<dd>
			            <ul class="notif-setting" id="ulglobal">
			                <li><a style="cursor:pointer;color: #FE7613;" onclick="document.logouSubmit.submit();"><?php echo JText::_('JLOGOUT'); ?></a></li>
			                <li><a style="cursor:pointer;color: #FE7613;" href="<?php echo (!empty($urlControlpanel) ? $urlControlpanel : "#")?>" class="control-panel">My Control Panel</a></li>		                
			          </ul>
			       </dd>
			    </dl>
			</div>
		</div>
	</div>	
<?php endif; ?>
	<input type="hidden" name="option" value="com_users" />
	<input type="hidden" name="task" value="user.logout" />
	<input type="hidden" name="return" value="<?php echo $return; ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>
<?php else : ?>
<blockquote>	
	<span><a href="index.php?option=com_users&view=login" class="logged jregister"><span><?php echo JText::_('JLOGIN'); ?></span></a></span>
	<span style="color: #FFFFFF">&nbsp;|&nbsp;</span>
	<span><a href="index.php?option=com_users&view=registration" class="logged jregister"><span><?php echo JText::_('Register as Candidate?'); ?></span></a></span>
	<span style="color: #FFFFFF">&nbsp;|&nbsp;</span>
	<span><a href="index.php?option=com_users&view=registration&layout=default_employer" class="logged jregister"><span><?php echo JText::_('Register as Employer?'); ?></span></a></span>		
</blockquote>
<div style="clear: both"></div>
<?php endif; ?>
